package com.lhnstart.learn.bases.static_;

/**
 * 静态方法demo
 *
 * @author lhn
 * @date 2023/07/10 16:16
 * @since 1.0.0
 **/
public class StaticMethod {

    public static void main(String[] args) {
        Student student = new Student("张三");
        Student.payFee(100);
        Student.payFee(200);
        Student.payFee(300);
        Student.showFee();
        Student.showFee();
        Student.showFee();
    }

}

class Student {

    // 普通成员
    private static String name;

    // 定义一个静态变量
    private static double fee = 0;

    public Student(String name) {
        fee++;
        this.name = name;
    }

    public static void payFee(double fee) {
        Student.fee += fee;
    }

    public static void showFee() {
        System.out.println("总学费有:" + Student.fee);
    }
}